/**
 * Created with IntelliJ IDEA.
 * User: skyline{http://my.oschina.net/skyline520}
 * Date: 12-11-23
 * Time: 下午3:44
 * To change this template use File | Settings | File Templates.
 */
Ext.define('Airways.view.system.roleoperation.RoleGridPanel',{
    extend:'Ext.grid.Panel',
    alias:'widget.roleOperationRoleGridPanel',
    anchor:'100% 80%',
    header:false,
    bodyBorder:false,
    autoScroll:true,
    forceFit:true,
    store:'system.role.RoleManageStore',
    viewConfig:{
        loadMask: new Ext.LoadMask(this,{msg:'数据加载中,请稍后...'})
    },
    initComponent:function (){
        this.bbar = this.buildBbar();
        this.columns = this.buildColumns();
        this.callParent(arguments);
    },
    buildBbar:function(){
        return Ext.create('Ext.PagingToolbar',{
            store:'system.role.RoleManageStore',
            displayInfo:true,
            displayMsg:'当前显示{0} - {1} 条,共 {2} 条',
            emptyMsg:'当前没有任何数据'
        });
    },
    buildColumns:function(){
        return [Ext.create('Ext.grid.RowNumberer'),
            {text:'角色编号',dataIndex:'roleNo'},
            {text:'角色名称',dataIndex:'roleName'},
            {text:'角色描述',dataIndex:'roleDesc'},
            {text:'状态',dataIndex:'status',renderer:this.changeStatus}];
    },
    //rendder status 转化 0 1 为 禁用  启用
    changeStatus:function(val) {
        if (val == 0) return "禁用";
        if (val == 1) return "启用";
    }
});
